<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>词多多代理商平台</title>
    <include file="Index:header" />
    <!----自动提示的input引入文件开始---------->
    <link rel="stylesheet" href="__PUBLIC__/css/textext.core.css" type="text/css" />
    <link rel="stylesheet" href="__PUBLIC__/css/textext.plugin.autocomplete.css" type="text/css" />
    <link rel="stylesheet" href="__PUBLIC__/css/textext.plugin.prompt.css" type="text/css" />
    <script src="__PUBLIC__/js/textext.core.js" type="text/javascript" charset="utf-8"></script>
    <script src="__PUBLIC__/js/textext.plugin.autocomplete.js" type="text/javascript" charset="utf-8"></script>
    <script src="__PUBLIC__/js/textext.plugin.prompt.js" type="text/javascript" charset="utf-8"></script>
    <!----自动提示的input引入文件结束---------->
<script type="text/javascript">
        $(function(){
            $(".help-side dl dd:eq(3)").addClass('cur');
            $("#top #topcon .nav li:eq(0)").addClass('cur');
        })
    </script>
    <script src="__PUBLIC__/js/main.js" type="text/javascript" charset="UTF-8"></script>

</head>
<body>
<include file="Index:top"/>
<div id="main">
<div id="main_left" class="container">
<div class="help-side"><include file="Index:left" />
<div class="side-slider"></div>
</div>
</div>
    <div id="main_right" class="container">
        <div class="title c mt10">消费统计</div>
            <div class="container p10 mt10">
                <table class="table" width="100%">
                    <tr align="center">
                    <if condition="$money['lastmonth'] neq 0"> 
                        <td class="font_g b color_green font_size_20">{$money['lastmonth']}</td>
                    <else/>
                        <td class="font_g b color_green font_size_20">0</td>
                    </if>   
                        <if condition="$money['yesterday'] neq 0"> <td class="font_g b color_green font_size_20">{$money['yesterday']}</td>
                            <else/><td class="font_g b color_green font_size_20">0</td>
                        </if>
                        <td class="font_g b color_green font_size_20">{$money['monthmoney']}</td>
                        <td class="font_g b color_green font_size_20">{$money['avg']}</td>
                        <td class="font_g b color_green font_size_20">{$money['total']}</td>
                    </tr>
                    <tr align="center">
                        <td>上月消费</td>
                        <td>昨日消费</td>
                        <td>本月消费</td>
                        <td>平均消费</td>
                        <td>累计消费</td>
                    </tr>
                </table>
            </div>
        <div id="seach" class="container p10 mt10">
            <table class="table">
                <tr>
                    <td>
                        <input id="textarea" class="input" style="width:80px; z-index:100; border-radius:5px;" placeholder="用户名"/>
                    </td>
                    <td style="padding-left:80px;">
                        <div id="website" class="dropdown" tabIndex="1">
                        <select id="site" style="width:150px;">
                            <option value="">请选择站点</option>
                        </select>
                    </div>
                    </td>
                    <td>起始日期</td>
                    <td>
                        <input type="text" name="stime" id="stime"  class="input date" style="width:70px;" onFocus="WdatePicker({isShowClear:false,readOnly:true})"/>
                    </td>
                    <td>截止日期</td>
                    <td>
                        <input type="text" name="etime" id="etime"  class="input date" style="width:70px;" onFocus="WdatePicker({isShowClear:false,readOnly:true})"/>
                    </td>
                    <td>
                        <input class="button_s green" type="submit"  id="button" onclick="query();"  value="查询"/>
                    </td>
                </tr>
            </table>
        </div>
        <div id="proxyinfo" class="container p10 mt10">
            <table class="table" width="100%">
                <tr style="border-bottom: 2px solid #eee;">
                    <th>用户名</th>
                    <th>关键词</th>
                    <th>消费记录</th>
                    <th>站点</th>
                    <th>日期</th>
                </tr>
                <tbody id="tbody">
                <volist name="list" id="vo">
                    <tr>
                        <td>{$vo['username']}</td>
                        <td>{$vo['keyword']}</td>
                        <td>{$vo['money']}</td>
                        <td>{$vo['website']}</td>
                        <td>{$vo['addtime']}</td>
                    </tr>
                </volist>
                </tbody>
            </table>
            <div class="mt10">
                <div class="page_list">
                    <div class="p_l">
                        {$pageshow}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="Index:footer"/>
<script type="text/javascript">
    $(function(){
        $("#website").sSelect();
        $("#keyword").sSelect();
    });

        function usersite(){
            userName=$("#textarea").val();
            if(userName==""){
                msgwarn("如要查询请先输入用户名");
                return false;
            }
            get_url = "__APP__/User/usersites";
            $.ajax({
                url:get_url,
                type:'POST',
                data:{'userName':userName},
                cache:false,
                dataType:"json",
                success:function(data){
                    if(data.status =='true'){
                        $("#site option:gt(0)").remove();
                        $.each(data,function(n,value){
                            if(value!='true'){
                                $("#site").append("<option value="+value+">"+value+"</option>");
                            }
                        });
                    }else{
                        msgwarn(data.Msg);
                    }
                }
            });
        }

        $("#textarea").blur(function(){
            setTimeout("usersite()",200);
        });

        function enterPress(e) {
            if (e.keyCode == 13) {
                setTimeout("usersite()",200);
            }
        }
    function query(){
        userName = $("#textarea").val();
        site = $(".dropselectbox h4").text();
        stime = $("#stime").val();
        etime = $("#etime").val();

        if(userName==""){
            msgwarn("请填写用户名");
            return false;
        }
        if(stime!=""&&etime==""){
            msgwarn("请选择截止日期");
            return false;
        }
        if(etime!=""&&stime==""){
            msgwarn("请选择起始日期");
            return false;
        }
        window.location="__URL__/index?userName="+userName+"&site="+site+"&stime="+stime+"&etime="+etime;
    }

</script>
<script type="text/javascript">
    function hash(str, hashSize)
    {
        var result = 0;
        for(var i = 0; i < str.length; i++)
            result += str.charCodeAt(i) + 31 * result;
        return result % hashSize;
    }

    $('#textarea')
            .textext({
                plugins : 'autocomplete',
                autocomplete : {
                    dropdownMaxHeight : '200px',

                    render : function(suggestion)
                    {
                        var icons = 'exclamation feed house information lock'.split(/ /g),
                                icon  = icons[hash(suggestion, icons.length)];
                        return  suggestion
                    }
                }
            })
            .bind('getSuggestions', function(e, data)
            {
                var list = [{$names}],
                        textext = $(e.target).textext()[0],
                        query = (data ? data.query : '') || '';

                $(this).trigger(
                        'setSuggestions',
                        { result : textext.itemManager().filter(list, query) }
                );
            });
</script>
</body>
</html>